﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.ChaseTask.ChaseModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	追号列表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <%Html.BeginForm(); %>
        <table class="table" width="100%">
            <tr class="th">
                <th colspan="5" align="left">查找条件</th>
            </tr>
            <tr>
                <td><%=Html.LabelFor(p=>p.Search.LotteryID) %>:<%=Html.DropDownListFor(p=>p.Search.LotteryID,Model.LotteryIDs,"选择彩种")%></td>
                <td><%=Html.LabelFor(p=>p.Search.ConsumptionRatio) %>:<%=Html.DropDownListFor(p=>p.Search.ConsumptionRatio,Model.ConsumptionRatios,"选择模式") %></td>
                <td><%=Html.LabelFor(p=>p.Search.WinModelID) %>:<%=Html.DropDownListFor(p=>p.Search.WinModelID,Model.WinModels,"选择模式") %></td>
                <td><%=Html.LabelFor(p=>p.Search.State) %>:<%=Html.DropDownListFor(p=>p.Search.State,Enum.GetValues(typeof(ChaseTaskState)).Cast<ChaseTaskState>()
                                                               .Select(p=>new SelectListItem{Selected=((short)p)==Model.Search.State,Text=p.GetName(),Value=((short)p).ToString()}),"状态")%></td>
                <td><input type="submit" value="查找" /></td>
            </tr>
        </table>
        <%Html.EndForm(); %>
        <table class="table" width="100%">
            <tr class="th">
                <th>彩种</th><th>元角模式</th><th>奖金模式</th><th>总期数</th><th>完成期数</th><th>撤消期数</th><th>状态</th><th>中奖中止</th><th>添加时间</th><th>停止时间</th><th>操作</th>
            </tr>
            <%var i = 0; foreach (var item in Model.ChaseList)
              {
                  %>
                    <tr <%=i++%2==1?"class='supersede'":"" %>>
                        <td><%=Model.LotteryIDs.Where(p => p.Value == item.LotteryID.ToString()).Select(p => p.Text).FirstOrDefault()%></td>
                        <td><%=Model.ConsumptionRatios.Where(p => p.Value == item.ConsumptionRatio.ToString()).Select(p => p.Text).FirstOrDefault()%></td>
                        <td><%=Model.WinModels.Where(p => p.Value == item.WinModelID.ToString()).Select(p => p.Text).FirstOrDefault()%></td>
                        <td><%=item.ChaseCount%></td>
                        <td><%=item.ExecuteCount %></td>
                        <td><%=item.CancleCount%></td>
                        <td><%=((ChaseTaskState)item.State) == ChaseTaskState.Normal ? "正在进行" : ((ChaseTaskState)item.State).GetName()%></td>
                        <td><%=item.StopWin>=0?"是":"否" %></td>
                        <td><%=string.Format("{0:yyyy-MM-dd<br>HH:mm:ss}",item.AddTime)%></td>
                        <td><%=string.Format("{0:yyyy-MM-dd<br>HH:mm:ss}",item.StopTime)%></td>
                        <td>
                            <label onclick="WriteDiv('<%=Url.Action("NumberList") %>','<%=item.ChoseNumber %>')" style="cursor:pointer; color:Blue;">号码</label>
                            <%=Html.ActionLink("详情", "Detail", Url.Route(new { Model.Search, ChaseModelCurrenPage = Model.pageInfo.CurrPage, ChaseID = item.ID }), Url.Route(new { @class = "a_blue" }))%>
                        </td>
                    </tr>
                  <%
                } 
                      var page=Model.pageInfo;
                      if(page!=null&&page.SunCount>page.PageCount){
                      %>
              <tr>
                <td colspan='10'>
                    <%=Html.Pager(page.CurrPage,page.PageCount,page.SunCount,"pageInfo.CurrPage",Url.Route(new {Model.Search}),"pageInfo.PageCount") %>
                </td>
              </tr>
              <%} %>
        </table>
    <p></p>
    <div id="div_ChoseNumber">
    </div>
 </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
<script type="text/javascript">
    function WriteDiv(url,param) {
        $('#div_ChoseNumber').load(url, {str:param });
    }
</script>
</asp:Content>
